/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package TimeRecording.business;

import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;

/**
 *
 * @author david
 */
public class DaisyChainSystem {

    public final static Date AGES_AGO =
            new GregorianCalendar(1900, 0, 1).getTime();
    
    public final static Date IN_THE_FUTURE =
            new GregorianCalendar(2999, 11, 31).getTime();

    public final static Date DEFAULT_START_TIME =
            new GregorianCalendar(1970, 0, 1, 9, 0, 0).getTime();

    public final static Date DEFAULT_FINISH_TIME =
            new GregorianCalendar(1970, 0, 1, 12, 0, 0).getTime();

    private final static GregorianCalendar TODAY =
            new GregorianCalendar();

    private final static GregorianCalendar TOMORROW =
            new GregorianCalendar();

    public final static String LIVE_PERSISTENCE_UNIT =
            "TimeRecordingLivePU";

    public final static String TRAINING_PERSISTENCE_UNIT =
            "TimeRecordingTrainingPU";

    static {
        TODAY.setTime(new Date());
        TODAY.set(Calendar.HOUR_OF_DAY, 0);
        TODAY.set(Calendar.MINUTE, 0);
        TODAY.set(Calendar.SECOND, 0);
        TODAY.set(Calendar.MILLISECOND, 0);

        TOMORROW.setTime(TODAY.getTime());
        TOMORROW.add(Calendar.DATE, 1);
    }

    public static GregorianCalendar getToday() {
        return TODAY;
    }

    public static GregorianCalendar getTommorow() {
        return TOMORROW;
    }

    public static Date cleanDate(Date date) {
        Calendar calendar = new GregorianCalendar();
        calendar.setTime(date);
        calendar.set(Calendar.HOUR_OF_DAY, 0);
        calendar.set(Calendar.MINUTE, 0);
        calendar.set(Calendar.SECOND, 0);
        calendar.set(Calendar.MILLISECOND, 0);
        return calendar.getTime();
    }
}
